'use-strict';
/**
 * 自己实现New操作符
 */
function myNew(Cons,...args){
    let obj = {};
    obj.__proto__ = Cons.prototype;
    let res = Cons.call(obj,args);
    return typeof res === 'object' ? res : obj;
}

//test
function Person(value){
    this.name = value;
}
Person.prototype.getName = function(){
    console.log(this.name);
    return this.name;
}
const suyechun = myNew(Person,'syc');
suyechun.getName();
